
var isMobile: boolean = undefined
export function IsMobile() {
    if (isMobile == undefined) {
        var userAgentInfo = navigator.userAgent
        cc.log(userAgentInfo)
        var Agents = [
            "Android",
            "iPhone",
            "SymbianOS",
            "Windows Phone",
            "iPad",
            "iPod"
        ];
        isMobile = false
        for (var v = 0; v < Agents.length; v++) {
            if (userAgentInfo.indexOf(Agents[v]) > 0) {
                isMobile = true
            }
        }
    }
    return isMobile
}
export function IsPC() {
    return !IsMobile()
}

var isIOS: boolean = undefined
export function IsIOS() {
    if (isIOS == undefined) {
        var userAgentInfo = navigator.userAgent
        cc.log(userAgentInfo)
        var Agents = [
            "iPhone",
            "iPad",
            "iPod"
        ];
        isIOS = false
        for (var v = 0; v < Agents.length; v++) {
            if (userAgentInfo.indexOf(Agents[v]) > 0) {
                isIOS = true
            }
        }
    }
    return isIOS
}


var isAndroid: boolean = undefined
export function IsAndroid() {
    if (isAndroid == undefined) {
        var userAgentInfo = navigator.userAgent
        cc.log(userAgentInfo)
        var Agents = [
            "Android",
        ];
        isAndroid = false
        for (var v = 0; v < Agents.length; v++) {
            if (userAgentInfo.indexOf(Agents[v]) > 0) {
                isAndroid = true
            }
        }
    }
    return isAndroid
}

var isMicroMessenger: boolean = undefined
export function IsWxMiniGame() {
    if (isMicroMessenger == undefined) {
        var userAgentInfo = navigator.userAgent
        cc.log(userAgentInfo)
        var Agents = [
            "MicroMessenger",
            "MiniGame",
        ];
        isMicroMessenger = (userAgentInfo.indexOf("MicroMessenger") > 0) && (userAgentInfo.indexOf("MiniGame") > 0)
    }
    return isMicroMessenger
}

export function GetUTC(): number {
    return new Date().getTime() / 1000
}

let _debug: boolean = false
export function SetDebug(d: boolean) {
    _debug = d
}
export function IsDebug(): boolean {
    return _debug
}